<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
	text-align: center;
}
</style>
<title>用户列表</title>
</head>
<body>
	<h1>用户列表</h1>
	<table border="0" cellspacing="0" align="center">
		<tr>
			<th>key</th>
			<th>学号</th>
			<th>姓名</th>
			<th>年龄</th>
			<th>性别</th>
			<th>生日</th>
			<th>喜好</th>
			<th>颜色</th>
			<th colspan="2">操作</th>
		</tr>
		<s:iterator value="#session.students" status="line">
			<%-- 隔行变色
			<s:if test="#line.isEven()">
				<tr style="background-color: yellow">
			</s:if>
			<s:if test="#line.isOdd()">
				<tr style="background-color: red">
			</s:if>
			 --%>
			<tr style="background-color:rgb(<s:property value="value.rgb" />)">
				<td><s:property value="key" /></td>
				<td><s:property value="value.id" /></td>
				<td><s:property value="value.name" /></td>
				<td><s:property value="value.age" /></td>
				<td><s:if test="value.gender.equals('male')">男</s:if> <s:elseif
						test="value.gender.equals('female')">女</s:elseif></td>
				<td><s:property value="value.birthday" /></td>
				<td><s:iterator value="value.favorite" var="fav">
						<s:if test="#fav.equals('chinese')">语文</s:if>
						<s:elseif test="#fav.equals('math')">数学</s:elseif>
						<s:elseif test="#fav.equals('english')">英语</s:elseif>
					</s:iterator></td>
				<s:url action="updateStudent" namespace="/studentsmanager"
					var="update">
					<s:param name="id" value="value.id"></s:param>
				</s:url>
				<s:url action="removeStudent" namespace="/studentsmanager"
					var="remove">
					<s:param name="id" value="value.id"></s:param>
				</s:url>
				<td><s:property value="value.rgb" /></td>
				<td><a href="<s:property value="update"/>">编辑</a></td>
				<td><a href="<s:property value="remove"/>">删除</a></td>
			</tr>
		</s:iterator>
	</table>
	<br />
	<s:url action="addStudent" namespace="/studentsmanager" var="add"></s:url>
	<a href="<s:property value="add"/>">添加用户</a>
</body>
</html>